<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>小练习1-JS进阶（一）</title>
    </head>
    <body>
        <pre>
            <code>
                    // 小练习1：请分析以下代码的运行过程
                    console.log('global');
                    setTimeout(function() {
                        console.log('timeout1');
                        new Promise(function(resolve1) {
                            console.log('promise1');
                            resolve1();
                        }).then(function() {
                            console.log('then1')
                        })

                        setTimeout(function() {
                            console.log('timeout2');
                            new Promise(function(resolve2) {
                                console.log('promise2');
                                resolve2();
                            }).then(function() {
                                console.log('then2')
                            })
                        })
                    })
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/p_1.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>
</html>